package com.github.edu.repair.manager.entity;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;

/**
 * Create by IntelliJ IDEA
 * 用户：王建
 * 日期：2018-8-20
 */
@Entity
@Table(name = "t_bx_wlk")
public class TBxWlk implements Serializable {
    private Integer id;
    private String name;
    private String wxfs;
    private String dw;
    private Integer clfl;
    private Integer clf;
    private Integer gsf;
    private TBxWlfl bxWlfl;
    private String clflmc;

    @Id
    @Column(name = "id")
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Basic
    @Column(name = "name")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "wxfs")
    public String getWxfs() {
        return wxfs;
    }

    public void setWxfs(String wxfs) {
        this.wxfs = wxfs;
    }

    @Basic
    @Column(name = "dw")
    public String getDw() {
        return dw;
    }

    public void setDw(String dw) {
        this.dw = dw;
    }

    @Basic
    @Column(name = "clfl")
    public Integer getClfl() {
        return clfl;
    }

    public void setClfl(Integer clfl) {
        this.clfl = clfl;
    }

    @Basic
    @Column(name = "clf")
    public Integer getClf() {
        return clf;
    }

    public void setClf(Integer clf) {
        this.clf = clf;
    }

    @Basic
    @Column(name = "gsf")
    public Integer getGsf() {
        return gsf;
    }

    public void setGsf(Integer gsf) {
        this.gsf = gsf;
    }

    @ManyToOne(cascade = {CascadeType.MERGE,CascadeType.REFRESH})
    @JoinColumn(name = "clfl",referencedColumnName = "id",updatable = false,insertable = false)
    public TBxWlfl getBxWlfl() {
        return bxWlfl;
    }

    public void setBxWlfl(TBxWlfl bxWlfl) {
        if(null!=bxWlfl){
            this.clflmc=bxWlfl.getMc();
        }
        this.bxWlfl = bxWlfl;
    }

    @Transient
    public String getClflmc() {
        return clflmc;
    }

    public void setClflmc(String clflmc) {
        this.clflmc = clflmc;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        TBxWlk tBxWlk = (TBxWlk) o;
        return Objects.equals(id, tBxWlk.id) &&
                Objects.equals(name, tBxWlk.name) &&
                Objects.equals(wxfs, tBxWlk.wxfs) &&
                Objects.equals(dw, tBxWlk.dw) &&
                Objects.equals(clfl, tBxWlk.clfl) &&
                Objects.equals(clf, tBxWlk.clf) &&
                Objects.equals(gsf, tBxWlk.gsf);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name, wxfs, dw, clfl, clf, gsf);
    }
}
